import 'package:boss/color_constant.dart';
import 'package:boss/models/store_menu.dart';
import 'package:boss/textStyle/text_style.dart';
import 'package:boss/ui/widget/image/base_image.dart';
import 'package:hi_common/hi_common.dart';
import 'package:flutter/material.dart';

import 'classification_management_chip.dart';

class ClassificationManagementItem extends StatelessWidget {
  final StoreMenu data;
  final VoidCallback onTap;

  const ClassificationManagementItem({
    Key key,
    @required this.data,
    this.onTap,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: onTap,
      behavior: HitTestBehavior.translucent,
      child: Container(
        height: 140.w,
        decoration: BoxDecoration(
          border: Border(
            bottom: BorderSide(
              color: ColorConstant.e6e6,
              width: 1.px,
            ),
          ),
        ),
        child: Row(
          crossAxisAlignment: CrossAxisAlignment.center,
          children: <Widget>[
            BaseImage(
              data.images,
              width: 110.w,
              height: 110.w,
              borderRadius: BorderRadius.circular(5),
            ),
            Expanded(
              child: Container(
                margin: EdgeInsets.only(
                  left: 20.w,
                ),
                child: Text.rich(
                  TextSpan(
                    text: data.menuName,
                    style: TextStyleConstant().normal_1_28,
                    children: [
                      WidgetSpan(
                        child: ClassificationManagementChip('菜品${data.commodityList.length}个'),
                      ),
                      WidgetSpan(
                        child: ClassificationManagementChip('加料${data.commodityMeterialList.length}个'),
                      ),
                    ],
                  ),
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
